<?php
require_once 'adminmenu.php';
?>
<script> 
/* when document is ready */
$(function() {
    /* initiate plugin */
    $("div.holder").jPages({
        containerID: "itemContainer"
    });
});
</script>
<div class="well">
    <h4>All comments:</h4> <hr />
    <ul id="itemContainer" class="list-no-bullet">
    <?php
    $content = new Models_Articles();
    $comments = $content->getAllCommentsForAdmin();
    foreach ($comments as $comment)
    {
        $userData = $content->getUserDataComment($comment['user_id']);
        $article = $content->getArticle($comment['article_id']);
        ?>
            <li><div class="alert alert-info">
                <h4><?php echo $comment['title']; ?></h4>
                <?php echo $comment['body']; ?>
                <hr />
                <p class="" style="padding: 1px 1px; margin: -5px 0;">
                    <i class="icon-user"></i> <a href="#"><?php echo $userData['login'] . ' (' . $userData['first_name'] . '  ' . $userData['second_name']; ?>)</a> 
                    | <i class="icon-calendar"></i> <?php echo $comment['created']; ?>
                    | <i class="icon-edit"></i> <a href="/<?php $content->printPath(); ?>articles/show/<?php echo $article['id']; ?>"><?php echo $article['title']; ?></a>
                    | <a href="/<?php $content->printPath(); ?>admin/commentremove/<?php echo $comment['id']; ?>" class="btn btn-danger btn-mini"><i class="icon-remove icon-white"></i> Delete</a>
                </p>
            </div></li>
        <?php
    }
    ?>
     </ul>
    <!-- navigation panel -->
    <div class="holder pagination">
        <a class="jp-previous jp-disabled">← previous</a>
        <a class="jp-current">1</a>
        <span class="jp-hidden">...</span>
        <a>2</a>
        <a>3</a>
        <a>4</a>
        <a>5</a>
        <a class="jp-hidden">6</a>
        <a class="jp-hidden">7</a>
        <a class="jp-hidden">8</a>
        <a class="jp-hidden">9</a>
        <span>...</span>
        <a>10</a>
        <a class="jp-next">next →</a>
    </div>
</div>